package cn.tedu.store.service;

import java.util.List;

import cn.tedu.store.service.ex.AccessDeniedException;
import cn.tedu.store.service.ex.CartNotFoundException;
import cn.tedu.store.service.ex.InsertException;
import cn.tedu.store.service.ex.UpdateException;
import cn.tedu.store.vo.CartVO;

/**
 * 购物车业务层接口
 * @author Administrator
 *
 */
public interface ICartService {

	/**
	 * 添加到购物车
	 * @param uid
	 * @param gid
	 * @param num
	 * @param username
	 * @throws InsertException
	 * @throws UpdateException
	 */
	void addToCart(
			Integer uid,Long gid,Integer num,String username
			) throws InsertException,UpdateException;
	
	/**
	 * 列出购物车中所有的数据
	 * @param uid
	 * @return
	 */
	List<CartVO> getByUid(Integer uid);
	
	List<CartVO> getByCids(Integer[] cids,Integer uid);
	
	/**
	 * 购物车数量增加一个
	 * @param cid
	 * @param uid
	 * @param username
	 * @return
	 * @throws AccessDeniedException
	 * @throws CartNotFoundException
	 * @throws UpdateException
	 */
	Integer addNum(Integer cid,Integer uid,String username) throws AccessDeniedException,CartNotFoundException,UpdateException;
	
	Integer reduceNum(Integer cid,Integer uid,String username) throws AccessDeniedException,CartNotFoundException,UpdateException;
	
}
